package com.luciddreams.model 
{
	import com.luciddreams.VO.*;
	import com.luciddreams.control.events.*;
	
	import mx.collections.*;
		
	[Bindable]
	public class ModelLocator
	{	
		public var hostname:String;
		
		private var _loggedinUser:UserVO=new UserVO();
		public var loggedin:Boolean=false;
		public var passwordRequested:Boolean=false;
		public var incorrectPassword:Boolean=false;

		public var users:ArrayCollection=new ArrayCollection();
		public var userGroups:ArrayCollection=new ArrayCollection();
		public var groups:ArrayCollection=new ArrayCollection();
		public var groupRights:ArrayCollection=new ArrayCollection();
		public var allGroups:ArrayCollection=new ArrayCollection();
		public var selectedGroup:GroupVO=new GroupVO();
		public var selectedUser:UserVO=new UserVO();  
		public var menu:ArrayCollection=new ArrayCollection();
		public var full_menu:ArrayCollection=new ArrayCollection();
		
		public var menu_grouprights:ArrayCollection=new ArrayCollection();
		
		public var page_type:Number=0;
		public var sub_page_type:Number=0;
		
		public function ModelLocator(){
		
		}
		
		
		public function set loggedinUser(val:UserVO):void{
			_loggedinUser=val;
			var getMenuEvent:GetMenuEvent=new GetMenuEvent(loggedinUser.id);
			getMenuEvent.dispatch();
		}
		
		public function get loggedinUser():UserVO{
			return(_loggedinUser);
		}

		static private var __instance:ModelLocator=null;
		
		static public function getInstance():ModelLocator
		{
			if(__instance == null)
			{
				__instance=new ModelLocator();
			}
			return __instance;
		}
	}
}